x86/bitops: Introduce variable/constant pairs for __{set,clear,change}_bit()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Dec 2017 12:56:24 +0000 (12:56 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 12 Jan 2018 11:35:24 +0000 (11:35 +0000)
commit2b84016c59dbe9f6e42e857a5d8176fd4e52c95c
treec9b2574985efeef803c32d800e46175ac18063c7
parent418ae6021d0a115ddbbf2b76a439c5327af66191
x86/bitops: Introduce variable/constant pairs for __{set,clear,change}_bit()

Just as with test_bit, the non-atomic set/clear/change helpers can be better
optimised by the compiler in the case that the nr parameter is constant, and
it often is.

This results in a general replacement of `mov $imm, %reg; bt* %reg, mem` with
the shorter and more simple `op $imm, mem`, also reducing register pressure.

The net diffstat is:
  add/remove: 0/1 grow/shrink: 5/17 up/down: 90/-301 (-211)

As a piece of minor cleanup, drop unnecessary brackets in the test_bit()
macro, and fix the indentation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/include/asm-x86/bitops.h